package com.userautentification.dao.imp;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.userautentification.dao.AddressDao;
import com.userautentification.dao.DataAccessLayerException;
import com.userautentification.dao.HibernateFactory;
import com.userautentification.entities.Address;

public class AddressDaoImp extends GenericDaoHibernate<Address, Long> implements
		AddressDao {

	Log log = LogFactory.getLog(AddressDaoImp.class);

	public AddressDaoImp() {
		HibernateFactory.buildIfNeeded();
	}

	/**
	 * Insert a new Address into the database.
	 * 
	 * @param adress
	 */
	public void create(Address adress) throws DataAccessLayerException {
		super.create(adress);
	}

	/**
	 * Delete a detached Address from the database.
	 * 
	 * @param address
	 */
	public void delete(Address address) throws DataAccessLayerException {
		super.delete(address);
	}

	/**
	 * Find an Address by its primary key.
	 * 
	 * @param id
	 * @return
	 */
	public Address find(Long id) throws DataAccessLayerException {
		return (Address) super.find(Address.class,id);
	}

	/**
	 * Updates the state of a detached Address.
	 * 
	 * @param address
	 */
	public void update(Address address) throws DataAccessLayerException {
		super.update(address);
	}

	/**
	 * Finds all Address in the database.
	 * 
	 * @return
	 */
	public List findAll() throws DataAccessLayerException {
		return super.findAll(Address.class);
	}

}